<?php $this->placeholder('container-class')->set('post_ad translate')?>
<?php $this->JQuery()->javascriptCaptureStart()?>
	function limits(obj, limit){
	  
		var text = $(obj).val(); 
		var length = text.length;
		if(length > limit){
		   $(obj).val(text.substr(0,limit));
			return false;
		 } else { 
		 	return true;
		 }
	 }


    // Control for Title
    $('input#tl_tc').keydown(function(event) {
        var charLength = 100 - $(this).val().length;
        if (charLength <0) {
            if ( event.keyCode == 8 || event.keyCode == 46 ) {

            } else {
                return false;
            }
        }
        else {
            $('span#counter_title').html('<em>'+charLength + '</em> <?php echo $this->t('characters remaining')?>');
        }
    });

	
	 $('input#cn_tc').keydown(function(event) {
        var charLength = 100 - $(this).val().length;
        if (charLength <0) {
            if ( event.keyCode == 8 || event.keyCode == 46 ) {

            } else {
                return false;
            }
        }
        else {
            $('span#counter_company').html('<em>'+charLength + '</em> <?php echo $this->t('characters remaining')?>');
        }
    });

	
    // Control for Description
    $('textarea#rlj_tc').keydown(function(event) {
        var charLength = 3000 - $(this).val().length;
        if (charLength <0) {
            if ( event.keyCode == 8 || event.keyCode == 46 ) {

            } else {
                return false;
            }
        }
        else {
            $('span#counter_description2').html('<em>'+charLength + '</em> <?php echo $this->t('characters remaining')?>');
        }
    });

	$('textarea#pe_tc').keydown(function(event) {
        var charLength = 3000 - $(this).val().length;
        if (charLength <0) {
            if ( event.keyCode == 8 || event.keyCode == 46 ) {

            } else {
                return false;
            }
        }
        else {
            $('span#counter_description3').html('<em>'+charLength + '</em> <?php echo $this->t('characters remaining')?>');
        }
    });

	
	$('textarea#cs_tc').keydown(function(event) {
        var charLength = 3000 - $(this).val().length;
        if (charLength <0) {
            if ( event.keyCode == 8 || event.keyCode == 46 ) {

            } else {
                return false;
            }
        }
        else {
            $('span#counter_description').html('<em>'+charLength + '</em> <?php echo $this->t('characters remaining')?>');
        }
    });
	
	$('#tl_en').before('<span class="before tlb"></span>');
	$('#tl_tc').before('<span class="after tla"></span>');
	$('#tl_en').appendTo('.tlb');
	$('#tl_tc').appendTo('.tla');
	
	$('#cs_en').before('<span class="before csb"></span>');
	$('#cs_tc').before('<span class="after csa"></span>');
	$('#cs_en').appendTo('.csb');
	$('#cs_tc').appendTo('.csa');
	$('.address .optional').after('<span class="hint"><?php echo $this->t('Addresses usually cannot be directly translated. Please input the address in Chinese.')?></span>');
	
	$('#st_en').before('<span class="before stb"></span>');
	$('#st_tc').before('<span class="after sta"></span>');
	$('#st_en').appendTo('.stb');
	$('#st_tc').appendTo('.sta');
	
	if($('#cn_en').length > 0){
		$('#cn_en').before('<span class="before cnb"></span>');
		$('#cn_tc').before('<span class="after cna"></span>');
		$('#cn_en').appendTo('.cnb');
		$('#cn_tc').appendTo('.cna');
	}


<?php $this->JQuery()->javascriptCaptureEnd()?>


<hgroup>
	<h1><?php echo $this->t('Post An Ad')?></h1>
	<h2><?php echo $this->t('It\'s free and takes less than a minute')?></h2>
</hgroup>
<section class="main_section grid_12">
	<section class="nav">
		<ol>
			<li><span><?php echo $this->t('1. Select Category')?></span></li>
			<li class="selected"><span><?php echo $this->t('2. Create Your Ad')?></span></li>
            <li><span><?php echo $this->t('3. Login')?></span></li>
		</ol>
	</section>
	<section class="translation form grid_10">
		<?php echo $this->form ?>
	</section>
</section>

<aside class="aside">
  <section class="help">
 
        <p class="nav">
        <a class="country_hk" href="#">Hong Kong</a>
        <?php /*
        <a href="<?php echo $this->url_tc?>" class="language_chi_t">??</a>
        <a href="<?php echo $this->url_en?>">English</a>
         * 
         */?>
        <a href="http://asiaclassifiedblog.tumblr.com/"><?php echo $this->t('Blog');?></a>
        <a href="http://asiaclassified.zendesk.com/home"><?php echo $this->t('Help');?></a>
        </p>

  </section>
<?php if (!Zend_Registry::isRegistered('loggedin_user')) :?>
  <section class="login">
        <div>
            <a href="<?php echo $this->geturl('login','user')?>" style="border: 0pt none; padding-left: 0pt;" rel="4cc15ba4e62d6cfd4f030000"><?php echo $this->t('Login')?></a>
            <a href="<?php echo $this->geturl('register','user')?>"><?php echo $this->t('Sign Up')?></a>
        </div>
  </section>
<?php else:?>
    <section class="login">
        <div>
            <a href="<?php echo $this->geturl('my-account','user')?>" style="border:0;padding-left:0" rel="<?php echo $this->loggedin_user->_id?>"><?php echo $this->t('My Account')?></a>
            <a href="<?php echo $this->geturl('logout','user')?>"><?php echo $this->t('Logout')?></a>
        </div>
    </section>
<?php endif; ?>
</aside>
